Fix Android template E2E for PRs targeting stable branches#57650
Merged
gabrieldonadel merged 1 commit intoJul 23, 2026
Conversation
On pull_request events github.ref_name is "<pr-number>/merge", which never matches *-stable*, so the template E2E always cloned the template's main branch. Template main now ships a Gradle 9.4.1 wrapper (bundling Kotlin 2.3.0), whose metadata the Kotlin 2.1.0 compiler used by @react-native/gradle-plugin on 0.86 cannot read, breaking :gradle-plugin:settings-plugin:compileKotlin on every PR to 0.86-stable. Use github.base_ref (set on PR events) so PRs targeting stable branches check out the matching template branch, falling back to ref_name for branch pushes.
cipolleschi
approved these changes
Jul 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
test_e2e_android_templateappcurrently fails on PRs targeting 0.86-stable (both debug and release flavors), e.g. https://github.com/react/react-native/actions/runs/30006334544/job/89219502470?pr=57646.The workflow picks which branch of
react-native-community/templateto generate the test project from:On
pull_requesteventsgithub.ref_nameis<pr-number>/merge, which never matches*-stable*, so PR runs always clone the template'smainbranch. That guard only works for direct pushes to the stable branch.This recently started failing because template
mainbumped its Gradle wrapper to 9.4.1, which bundles the Kotlin 2.3.0 stdlib. The generated project compiles@react-native/gradle-pluginfrom source with Kotlin 2.1.0 on 0.86, and that compiler can only read Kotlin metadata up to 2.2.0, so:gradle-plugin:settings-plugin:compileKotlinfails with:The fix is to use
github.base_ref(the PR target branch, e.g.0.86-stable) when it is set, falling back togithub.ref_namefor branch pushes:BRANCH=${{ github.base_ref || github.ref_name }}With this, PRs targeting 0.86-stable check out the template's
0.86-stablebranch (Gradle 9.3.1 / Kotlin 2.2 metadata, readable by the 2.1.0 compiler), matching the intent of the original comment in the workflow.Note:
e2e-ios-templateapp.ymlhas the same pattern (currently not failing since the Kotlin issue is Android-only), andmaincarries the same logic in both files, so future stable branches will inherit this. Happy to follow up there if desired.Changelog:
[INTERNAL] [FIXED] - Use the PR base branch to pick the template branch in the Android template E2E workflow
Test Plan:
scripts/e2e/init-project-e2e.jsdoes a plaingit checkoutof the value passed as--currentBranchin the cloned template repo, and that the0.86-stablebranch exists inreact-native-community/template(with a Gradle 9.3.1 wrapper, vs 9.4.1 on templatemain).test_e2e_android_templateappshould now generate the project from the template's0.86-stablebranch and pass, while all other jobs remain unaffected.